import React, { Component } from 'react'
import { Modal, Button } from 'antd'
import { nanoid } from 'nanoid'

export default class AddUser extends Component {
  state = {
    isModalVisible: false,
    addData: '',
  }
  render() {
    let { isModalVisible } = this.state
    return (
      <>
        性名: <input type="text" name="" ref={(v) => (this.name = v)} /> <br />
        <br />
        地址: <input type="text" name="" ref={(v) => (this.adress = v)} />{' '}
        <br />
        <br />
        生日: <input type="text" name="" ref={(v) => (this.birth = v)} /> <br />
        <br />
        <Button onClick={this.add}>添加用户</Button>
      </>
    )
  }
  add = () => {
    let { addData } = this.state
    let { name, adress, birth } = this
    addData = {
      name: name.value,
      adress: adress.value,
      birth: birth.value,
      id: nanoid(),
    }
    this.props.history.push({
      pathname: '/home/listYimiao',
      query: {
        user: addData,
      },
    })
  }
}
